home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / vinfo.zip / VINFO.ASM
Assembly Source File  |  1991-06-19  |  3KB  |  67 lines

  1. ;«RM82»«TS8,16,24,32,40,48»10/21/90
  2. ; 11/20/90
  3.  
  4. ;============================================================================
  5. ;   Copyright (C) Copr. 1990 by Sidney J. Kelly
  6. ;           All Rights Reserved.
  7. ;           Sidney J. Kelly
  8. ;           150 Woodhaven Drive
  9. ;           Pittsburgh, PA 15228
  10. ;           home phone 412-561-0950 (7pm to 9:30pm EST)
  11. ;============================================================================
  12.  
  13. DOSSEG
  14. .model medium, BASIC
  15. .code
  16.  
  17. ;============================================================================
  18. ; DECLARE SUB VIDINFO (MODE%, ROW%, COLUMN%, CURPAGE%, PAGESIZE%)
  19. ; CALL VIDINFO(MODE%, ROW%, COLUMN%, CURPAGE%, PAGESIZE%)
  20. ; Purpose:
  21. ;       Returns information about current video display status.
  22. ;       Mode%     = current video mode using BIOS format
  23. ;       Row%      = number of rows currently being displayed
  24. ;       Cols%     = width of display in columns
  25. ;       Curpage%  = currently active page
  26. ;       Pagesize% = size of current page in bytes, default is 4kb
  27. ;                   for an 80 * 25 display.
  28. ; Note:
  29. ;       PAGESIZE% on many HERC clones will be incorrect and reflect the
  30. ; information of the HERC display in HALF mode or 16kb size.
  31. ; Routine will store correct Row% length in BIOS ram for CGA, HERC & MONO
  32. ;============================================================================
  33.  
  34. EVEN
  35. VIDINFO Proc FAR BASIC  \
  36. MODE:Ptr, ROW:Ptr, COLUMN:Ptr, CURPAGE:Ptr, PAGESIZE:Ptr
  37.  
  38.     Xor     AX,AX                   ; clear AX
  39.     Mov     ES,AX                   ; set ES to BIOS ram
  40.     Mov     BX,MODE                 ; get address of Mode
  41.     Mov     AL,Byte Ptr ES:[0449h]  ; read MODE from BIOS ram
  42.     Mov     [BX],AX                 ; store value
  43.     Mov     BX,ROW                  ; get address of Row
  44.     Xor     AH,AH                   ; clear high byte
  45.     Mov     AL,Byte Ptr ES:[0484h]  ; read ROW from BIOS ram
  46.     Or      AL,AL                   ; zero? (HERC, CGA & MONO give 0)
  47.     JNZ     @f                      ; nope, so skip ahead (EGA or above)
  48.     Mov     AX,24                   ; load default value - 1
  49.     Mov     Byte Ptr ES:[0484h],AL  ; store it BIOS ram to save time next
  50.                     ; time
  51. @@:
  52.     Inc     AX                      ; raise value to 1 biased number
  53.     Mov     [BX],AX                 ; store value
  54.     Mov     BX,COLUMN               ; get address of Column
  55.     Mov     AX,ES:[044Ah]           ; read COLUMN from BIOS ram
  56.     Mov     [BX],AX                 ; store value
  57.     Mov     BX,CURPAGE              ; get address of Current Page
  58.     Xor     AH,AH                   ; clear high byte
  59.     Mov     AL,Byte Ptr ES:[0462h]  ; read CURPAGE from BIOS ram
  60.     Mov     [BX],AX                 ; store result
  61.     Mov     BX,PAGESIZE             ; get address of PAGESIZE
  62.     Mov     AX,ES:[044Ch]           ; get size of video page
  63.     Mov     [BX],AX                 ; store result
  64.     RET                             ; MASM does cleanup
  65. VIDINFO ENDP
  66. END
  67.